﻿using IterationLife.Domains.Sports.Models;
using Util;
using Util.Maps;

namespace IterationLife.Football.MTSports.Dtos.Sports
{
    /// <summary>
    /// SportUsers数据传输对象扩展
    /// </summary>
    public static class SportUserDtoExtension
    {
        /// <summary>
        /// 转换为SportUsers实体
        /// </summary>
        /// <param name="dto">SportUsers数据传输对象</param>
        public static SportUser ToEntity(this SportUserDto dto)
        {
            if (dto == null)
                return new SportUser();
            return dto.MapTo(new SportUser(dto.Id.ToGuid()));
        }
        
        /// <summary>
        /// 转换为SportUsers数据传输对象
        /// </summary>
        /// <param name="entity">SportUsers实体</param>
        public static SportUserDto ToDto(this SportUser entity)
        {
            if (entity == null)
                return new SportUserDto();
            return entity.MapTo(new SportUserDto());
        }
        
    }
}
